//引入第三方包 express
var express = require('express')
var fs = require('fs')
var path = require('path')

//实例化 express
var app = express()

//设置静态托管
app.use(express.static('static'))

//post请求中间件
app.use(express.json())
app.use(express.urlencoded({ extended: false }))

//导入子路由
var userRouter = require('./router/userRouter')

//注册子路由
app.use('/user', userRouter)

//设置监听
app.listen(8080, () => {
    console.log('服务端运行在:http://localhost:8080');
})